#include "node.h"

/**
 * Node
 */
Node::Node() noexcept {
    prev = this;
    next = this;
}

Node::~Node() {
    Node * n;
    while ( next != this )
    {
        n = next;
        next = next->next;
        n->next = n;
        delete n;
    }
}

void Node::insert( Node * node ) {
    node->next = this;
    node->prev = this->prev;
    this->prev->next = node;
    this->prev = node;
}
